﻿using SuperFrame.Charts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Cd.Charts
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
        void testData()
        {
            var ran = new Random();
            Thread thr = new Thread(() =>
            {
                while (true)
                {
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        //Chart0.Series[0].Points.Add(new PointTime(DateTime.Now, Convert.ToDouble(ran.Next(100, 199))));
                        //Chart1.Series[0].Points.Add(new PointTime(DateTime.Now, Convert.ToDouble(ran.Next(100, 199))));
                    }));
                    Thread.Sleep(ran.Next(500, 3000));
                }
            });
            thr.IsBackground = true;
            thr.Start();
        }

        private void Btn_data(object sender, System.Windows.RoutedEventArgs e)
        {
            var ran = new Random();
            for (int i = 0; i < 100; i++)
            {
                //Chart0.Series[0].Points.Add(new PointTime(DateTime.Now, Convert.ToDouble(ran.Next(100, 199))));
                //Chart1.Series[0].Points.Add(new PointTime(DateTime.Now, Convert.ToDouble(ran.Next(100, 199))));
            }
        }

    }
}
